package cn.itsource.pethome.org.domain;

import cn.itsource.pethome.base.domain.BaseDomain;
import cn.itsource.pethome.base.domain.CreatePassword;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.*;


@Data
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "t_employee")
public class Employee  implements BaseDomain, CreatePassword {
    @Id
    private Long id;
    @NotBlank(message = "员工姓名不能为空")
    @NotNull(message = "员工姓名不能为空")
    private String username;
    @Email(message = "员工的邮箱不正确")
    private String email;
    @Pattern(regexp="[0-9-()（）]{7,18}",message = "手机号格式不正确")
    private String phone;
    @Min(value = 0l,message = "年龄不能小于0岁")
    @Max(value = 200l,message = "最大年龄不能超过200岁")
    private Integer age;
    private Boolean state;
    private Boolean del;
    //关联的部门id
    private Long departmentId;
    private Boolean shopAdmin;
    private Long shopId;
    //盐值
    private String salt;
    private String password;
    //上级部门
    @Transient
    private Department dept;

    public Employee(long l, String username) {
        this.id  = l;
        this.username = username;
    }
}
